package com.leetcode.string;

import java.util.Scanner;

public class LengthOfLastWord {


	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		String s=in.nextLine();
		
		int result=lengthOfLastWord(s);
		System.out.println(result);
	}
	public static int lengthOfLastWord(String s) {
        if(s.length()==0||s==null) return 0;
        //if(s.endsWith(" ")) return 0;
        String[] strArray=s.split(" ");
        if(strArray.length==0) return 0;
        int len=strArray.length;
        int i=0;
        char[] arr=strArray[len-1].toCharArray();
        while(i<arr.length){
        	i++;
        }
        return i;
    }
}
